<body>
	<div class="fixed hwrap">
		<a href="javascript:history.back(-1);" target="_parent" class="rel">
			<i class="icon-angle-left"></i>
		</a>
		<a href="javascript:;" target="_parent"></a>
		<h3 class="dyc">订单列表</h3>
	</div>
	<div style="height:45px;"></div>
	<div class="m_goods" >
        <?php if($goodslist):?>
        <ul class="wrap" id="wrap" style="background-color: #fff;">
            <?php foreach($goodslist as $key => $value):?>
	    		<li data-id="" class="animi-fade-show">
					<fieldset class="layui-elem-field">
					  <div class="layui-field-box">
					    商品：<?=$value['goodsName']?> <?=$value['goodsSkuName']?><br/>
					    数量：x<?=$value['buyNumber']?><br/>
						价格：<?=$value['buyPrice']?><br/>
					    状态：<?=$value['workFlow']?><br/>
					    收货地址：<?=$value['addressMx']?><br/>
						联系人：<?=$value['addressName']?>&nbsp;<?=$value['addressTel']?><br/>
						物流：<?=$value['expressName']?>&nbsp;<?=$value['expressNum']?><br/>
					    备注：<?=$value['text']?><br/>
					    时间：<?=$value['time']?><br/>
					  </div>
					</fieldset>
	    		</li>
            <?php endforeach;?>
    	</ul>
		<div id="loading" class="loading hide">正在加载....</div>
        <!--分页-->
       <?php else:?>
           <div class="trans_body cF" style="text-align:center;">还没有记录哦！</div>
      <?php endif;?>
    </div>
<script>
var page = 2;
$(window).scroll(function() {
	timer=null;
	if($(document).scrollTop() >= $(document).height() - $(window).height()){
		 $('#loading').show();
		 window.clearTimeout(timer);
		 $.post("/user/oldorder",{page:page},function(rs){
			if(rs.code == 0){
				if(rs.data.max_page < page){
					$('#loading').text("亲，没有更多了！").show();
					timer=window.setTimeout('$("#loading").fadeOut()',1200);
				}else{
					var html = "";
					var goodslist = rs.data.goodslist;
					for(var i = 0; i<goodslist.length;i++){
						html += '<fieldset class="layui-elem-field">';
						html += '	<div class="layui-field-box">';
						html += '		商品：' + goodslist[i].goodsName + ' ' + goodslist[i].goodsSkuName + '<br/>';
						html += '		数量：x' + goodslist[i].buyNumber + '<br/>';
						html += '		价格：' + goodslist[i].buyPrice + '<br/>';
						html += '		状态：' + goodslist[i].workFlow + '<br/>';
						html += '		收货地址：' + goodslist[i].addressMx + '<br/>';
						html += '		联系人：' + goodslist[i].addressName + '&nbsp;' + goodslist[i].addressTel + '<br/>';
						html += '		时间：' + goodslist[i].time + '<br/>';
						html += '	</div>';
						html += '</fieldset>';
						html += '</li>';
					}
					$("#wrap").append(html);
					var i = 0 ;
					var t=window.setInterval(function(){
						i++;
						if(i>5){
							i=0;
							window.clearInterval(t);
						}
					},350);
					$('#loading').hide();
					page++;
				}
			}else{
				layer.msg(rs.msg);
			}
		},"json");
	}
});


</script>
